#include <iostream>
#include "SPSCQueue.h"
#include <thread>
#include <unistd.h>






void test2() {
  using namespace rigtorp;
  SPSCQueue<int> q(1);
  auto t = std::thread([&] {
    while (!q.front())
      ;
      std::cout << q.Get(0) << std::endl;
    q.Pop();
  });
  q.Push(4);
  t.join();
}

void test1() {
  using namespace rigtorp;
  SPSCQueue<int> q(2);
  q.Push(5);
  q.Push(6);
  std::cout << "length:" << q.Length() << std::endl;
  std::cout << "get:" << q.Get(1) << std::endl;
  std::cout << "get:" << q.Get(0) << std::endl;
  q.Pop();
  q.Pop();
}

///            g++   SPSCQueueExample.cpp  -std=c++11 -lpthread
int main(int argc, char *argv[]) {



 // test2();
 test1();
  return 0;
}



